import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/admin/acl/index/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/admin/acl/index/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/admin/acl/index/logout',
    method: 'post'
  })
}

export function reqUserList(page, limit) {
  return request({
    url: `/admin/acl/user/${page}/${limit}`,
    method: 'get'
  })
}
export function reqAddUser(obj) {
  console.log(obj)
  return request({
    url: `/admin/acl/user/save`,
    method: 'post',
    data: obj
  })
}
export function reqDoAssign(userId, roleId) {

  return request({
    url: `/admin/acl/user/doAssign`,
    method: 'post',
    params: {
      userId,
      roleId
    }
  })
}
export function reqUserInfoUpdate({ id, username, nickName }) {
  return request({
    url: `/admin/acl/user/update`,
    method: 'put',
    data: {
      id,
      username,
      nickName
    }
  })
}
export function reqUserRemove(id) {
  return request({
    url: `/admin/acl/user/remove/${id}`,
    method: 'delete'
  })
}
